#ifndef	__BFX_REF_XMLLOADER_H__
#define	__BFX_REF_XMLLOADER_H__

namespace BFX
{

//////////////////////////////////////////////////////////////////////////////

class REFXMLLoader : public REFObject
{
public:
	REFXMLLoader();
	virtual ~REFXMLLoader();

	bool Load(REFXMLDocument* pDoc, REFXMLReader* pReader, bool bRreserveWhitespace);

	bool IsErrorOccurred() const;
protected:

	// Start loading the document from where current xmlreader is pointing at.
	bool LoadDocSequence(REFXMLDocument* pParentDoc);

	REFXMLNode* LoadNode(bool bSkipOverWhitespace);
	REFXMLAttribute* LoadAttributeNode();
	REFXMLAttribute* LoadDefaultAttribute();
	void LoadAttributeValue(REFXMLNode* pParent);
	REFXMLEntityReference* LoadEntityReferenceNode();
	REFXMLDeclaration* LoadDeclarationNode();
	REFXMLDocumentType* LoadDocumentTypeNode();
	
	void LoadDocumentType(REFXMLSchemaInfo* pDtdSchemaInfo, REFXMLDocumentType* pDtNode);

protected:
	REF<REFXMLReader>	m_pReader;
	REFXMLDocument*		m_pDoc;
	bool	m_bPreserveWhitespace;
};

}	//	namespace BFX

#endif	//	__BFX_REF_XMLLOADER_H__
